<%-- 
    Document   : edit-professor
    Created on : 13/06/2013, 14:51:10
    Author     : Eduardo
--%>

<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="Model.*"%>
<%@page import="Controller.*"%>
<%@page import="java.sql.*" %> 
<%@page import="java.io.*" %>

<%
    String id = request.getParameter("id");
    Query a = new Query();
    ResultSet rss = a.getSolicitacoes(id);
    if (rss.next()) {
        ArrayList<Preferencias> profs = a.getProfessorDisc(rss.getInt("id_disciplina"));
        ResultSet Salas = a.getSalas();
%>
<script src="js/gerencia.js"></script> 
<script src="js/script.js"></script>
<div class="modal-header">  
    <a class="close" data-dismiss="modal">×</a>  
    <h3>Gerencia solicitação(a): <% out.println(rss.getString("id"));%></h3>
</div>
<div class="modal-body">
    <div id="info"></div>
    <form class="form-horizontal" id="gerencia">
        <input type="hidden" name="disciplina_id" value="<%=rss.getString("id")%>">
        <input type="hidden" name="action" value="salvaProfSala">
        <input type="hidden" name="id" value="<%=request.getParameter("id")%>">
        <div class="professor">
            <h4>Selecione um professor</h4>
            <%
                for (Preferencias p : profs) {
                    out.print("<div class='span6' style='margin:0px'>");
                    if (p.getPontos() == 3) {
                        out.print("<div class='verde'><input type='radio' name='professor' value='" + p.getId() + "' checked>  " + p.getNome() + " <i class='icon icon-arrow-up'></i></div>");
                    } else if (p.getPontos() == 2) {
                        out.print("<div class='amarelo'><input type='radio' name='professor' value='" + p.getId() + "'> " + p.getNome() + "</div>");
                    } else if (p.getPontos() == 1) {
                        out.print("<div class='vermelho'><input type='radio' name='professor' value='" + p.getId() + "'> " + p.getNome() + "</div>");
                    } else {
                        out.print("<div><input type='radio' name='professor' value='" + p.getId() + "'> " + p.getNome() + "</div>");
                    }
                    out.print("</div>");
                }
            %>

            <br/>
            <a class="btn btn-success avancar">Avançar</a> 
        </div>
        <div class="sala" style="display:none">
            <h4>Selecione a sala</h4>
            <table class="table table-condensed">
                <thead>
                <th></th>
                <th>Numero</th>
                <th>Tipo</th>
                <th>Capacidade</th>
                </thead>  
                <%
                    while (Salas.next()) {
                        out.print("<tr>");
                        out.print("<td><input type='radio' name='sala' value='" + Salas.getString("id") + "'></td>");
                        out.print("<td>" + Salas.getString("numero") + "</td>");
                        out.print("<td>" + Salas.getString("tipo") + "</td>");
                        out.print("<td>" + Salas.getString("capacidade") + "</td>");
                        out.print("</tr>");
                    }
                %>
            </table>
            <br/>
            <a class="btn btn-success avancar2">Avançar</a> 
        </div>
        <div id="checa">
        </div>
    </form>
</div>
<div class="modal-footer" style="display:none">  
    <a class="btn btn-success salvar" xform="gerencia" xid="<%=request.getParameter("id")%>" url="gerencia-solicitacoes.jsp">Aprovar</a>  
    <a class="btn btn-inverse fechar" data-dismiss="modal">Fechar</a>  
</div>
<% }%>



